package pattern2.GuardedSuspension.demo;

/**
 * @创建人 liweijia
 * @创建时间 2022/7/23
 * @描述 程序的主要用途
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        // 锁
        Object lock = new Object();

        // 接收者
        Receiver receiver = new Receiver(lock);
        receiver.start();

        // 发送者
        Sender sender = new Sender(lock, receiver);
        sender.start();

        // 接收者完成任务后结束主线程
        receiver.join();
    }
}
